package com.city.controller;

import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.Map;

/**
 * @deprecation 登陆控制器
 * @email leichuqiao@126.com
 * @author 雷楚桥
 * @date 2018-07-07 15:26
 */
@Controller
public class LoginController {

    /**
     * @deprecation 登陆主界面
     * @author 雷楚桥
     * @date 2018-07-07 15:26
     */
    @RequestMapping("/login.html")
    public String login(@Param("system") Integer system,
                        HttpSession session,
                        Map<String,Object> map){
        session.setAttribute("loginTel",null);
        map.put("system",system);
        return "/login/index";
    }

    /**
     * @deprecation 提示用户需要登陆
     * @author 雷楚桥
     * @date 2018/7/23 8:58
     */
    @RequestMapping("/for_login")
    public String for_login(HttpServletRequest request,
                            Map<String,Object> map){
        String system = request.getParameter("system");
        map.put("system",system);
        return "/login/for_login";
    }

    /**
     * @deprecation 退出
     * @author 雷楚桥
     * @date 2018/7/23 8:58
     */
    @RequestMapping("/login_out")
    public String login_out(HttpSession session){
        session.removeAttribute("authList");
        return "/login/login_out";
    }

}
